# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 153
n 153(None)[return None
]:
	i: 66(), 118(), 137()
	o: 

nname: 137
n 137(None)[self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('dummy', 'dummy', 'dummy', 'dummy'))
]:
	i: 105(f)
	o: 153()

nname: 118
n 118(None)[self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('softdec', 'softdec', 'softsub', 'dummy'))
]:
	i: 105(t)
	o: 153()

nname: 105
n 105(arch == 'softdec')[]:
	i: 0(f)
	o: 118(t), 137(f)

nname: 66
n 66(None)[self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('havana2:adapter=%u:avsync=%%u' % havana_adapter, 'havana2:adapter=%u' % havana_adapter, 'softsub', 'havana2'))
]:
	i: 0(t)
	o: 153()

nname: 0
n 0(arch == 'stb7100')[self.dpl = WyPlayerProxy()
self.wpl = self.dpl.wyplayer
self.havana_adapter = havana_adapter
self._WyPlayer__aspect_ratio = None
self._WyPlayer__display_format = None
]:
	i: 
	o: 66(t), 105(f)

nname: 0
n 0(None)[self.dpl = WyPlayerProxy()
self.wpl = self.dpl.wyplayer
self.havana_adapter = havana_adapter
self._WyPlayer__aspect_ratio = None
self._WyPlayer__display_format = None
if arch == 'stb7100':
	self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('havana2:adapter=%u:avsync=%%u' % havana_adapter, 'havana2:adapter=%u' % havana_adapter, 'softsub', 'havana2'))
else:
	if arch == 'softdec':
		self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('softdec', 'softdec', 'softsub', 'dummy'))
	else:
		self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('dummy', 'dummy', 'dummy', 'dummy'))
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aae8c>}
nname: 49
n 49(None)[]:
	i: 3(), 40(), 47(AE)
	o: 

nname: 47
n 47(None)[]:
	i: 30(f)
	o: 49(AE)

nname: 40
n 40(None)[]:
	i: 30(t)
	o: 49()

nname: 30
n 30(<dummy_ex3> EXC_MATCH KeyError)[]:
	i: 0(except)
	o: 40(t), 47(f)

nname: 3
n 3(None)[self.dpl.props[name].set_notify(cb)
]:
	i: 0(try)
	o: 49()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 30(except)

nname: 30
n 30(None)[except KeyError:
	pass
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self.dpl.props[name].set_notify(cb)
]:
	i: 
	o: 30()

nname: 0
n 0(None)[try:
	self.dpl.props[name].set_notify(cb)
except KeyError:
	pass
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaf4c>}
nname: 38
n 38(None)[]:
	i: 3(), 27(), 37(AE)
	o: 

nname: 27
n 27(None)[return 'unknown'
]:
	i: 0(except)
	o: 38()

nname: 3
n 3(None)[return self.dpl.props['status'].get()
]:
	i: 0(try)
	o: 38()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 27(except)

nname: 27
n 27(None)[except:
	return 'unknown'
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return self.dpl.props['status'].get()
]:
	i: 
	o: 27()

nname: 0
n 0(None)[try:
	return self.dpl.props['status'].get()
except:
	return 'unknown'
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaaec>}
nname: 0
n 0(None)[return self.dpl.props['exception'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa64c>}
nname: 38
n 38(None)[]:
	i: 3(), 27(), 37(AE)
	o: 

nname: 27
n 27(None)[return 0.0
]:
	i: 0(except)
	o: 38()

nname: 3
n 3(None)[return self.dpl.props['speed'].get()
]:
	i: 0(try)
	o: 38()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 27(except)

nname: 27
n 27(None)[except:
	return 0.0
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return self.dpl.props['speed'].get()
]:
	i: 
	o: 27()

nname: 0
n 0(None)[try:
	return self.dpl.props['speed'].get()
except:
	return 0.0
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa90c>}
nname: 0
n 0(None)[self.dpl.props['speed'].set(value)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaf2c>}
nname: 0
n 0(None)[return self.dpl.props['uri'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa7cc>}
nname: 0
n 0(None)[return self.dpl.props['duration'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa90c>}
nname: 0
n 0(None)[return self.dpl.props['container'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaf2c>}
nname: 0
n 0(None)[return self.dpl.props['aid'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa86c>}
nname: 0
n 0(None)[self.dpl.props['aid'].set(value)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aad2c>}
nname: 0
n 0(None)[return self.dpl.props['vid'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa5ac>}
nname: 0
n 0(None)[self.dpl.props['vid'].set(value)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa50c>}
nname: 0
n 0(None)[return self.dpl.props['sid'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa6ec>}
nname: 0
n 0(None)[self.dpl.props['sid'].set(value)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa4ec>}
nname: 0
n 0(None)[return self.dpl.props['scrambled'].get()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa58c>}
nname: 0
n 0(None)[return dict(map(transform, ('audio', 'video', 'sub', 'data'), self.wpl.playback.pos(pts, rel, tb[0], tb[1])))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaa8c>}
nname: 0
n 0(None)[return self._WyPlayer__get_pos(None, False, False, (1, 0))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa4cc>}
nname: 0
n 0(None)[return (x, y / 1000.0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa70c>}
nname: 0
n 0(None)[return (x, y / 1000.0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa60c>}
nname: 0
n 0(None)[return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, False, (1, 1000))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aab2c>}
nname: 0
n 0(None)[return self._WyPlayer__get_pos(None, True, False, (1, 90000))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa68c>}
nname: 0
n 0(None)[return (x, y / 1000.0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa9ec>}
nname: 0
n 0(None)[return (x, y / 1000.0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aad2c>}
nname: 0
n 0(None)[return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, True, (1, 1000))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa54c>}
nname: 21
n 21(None)[self._WyPlayer__display_format = format
self.wpl.set_vopts('display_format=%s' % format)
]:
	i: 12(), 20()
	o: 

nname: 20
n 20(None)[]:
	i: 0(f)
	o: 21()

nname: 12
n 12(None)[]:
	i: 0(t)
	o: 21()

nname: 0
n 0(format not in ('pan_scan', 'letter_box', 'center_cut_out', 'fullscreen'))[]:
	i: 
	o: 12(t), 20(f)

nname: 0
n 0(None)[if format not in ('pan_scan', 'letter_box', 'center_cut_out', 'fullscreen'):
	pass
self._WyPlayer__display_format = format
self.wpl.set_vopts('display_format=%s' % format)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaa4c>}
nname: 0
n 0(None)[return self._WyPlayer__display_format
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa5ac>}
nname: 21
n 21(None)[self._WyPlayer__aspect_ratio = ratio
self.wpl.set_vopts('tv_aspect_ratio=%s' % ratio)
]:
	i: 12(), 20()
	o: 

nname: 20
n 20(None)[]:
	i: 0(f)
	o: 21()

nname: 12
n 12(None)[]:
	i: 0(t)
	o: 21()

nname: 0
n 0(ratio not in ('4_3', '16_9'))[]:
	i: 
	o: 12(t), 20(f)

nname: 0
n 0(None)[if ratio not in ('4_3', '16_9'):
	pass
self._WyPlayer__aspect_ratio = ratio
self.wpl.set_vopts('tv_aspect_ratio=%s' % ratio)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa92c>}
nname: 0
n 0(None)[return self._WyPlayer__aspect_ratio
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa54c>}
nname: 27
n 27(None)[self.wpl.set_aopts('spdif_es=%u' % int(enable))
]:
	i: 18(), 26()
	o: 

nname: 26
n 26(None)[]:
	i: 0(f)
	o: 27()

nname: 18
n 18(None)[]:
	i: 0(t)
	o: 27()

nname: 0
n 0(enable not in (False, True))[]:
	i: 
	o: 18(t), 26(f)

nname: 0
n 0(None)[if enable not in (False, True):
	pass
self.wpl.set_aopts('spdif_es=%u' % int(enable))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaaac>}
nname: 156
n 156(None)[return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])
]:
	i: 76(JA), 90(), 133(JA), 151(), 155()
	o: 

nname: 155
n 155(None)[]:
	i: 104(f)
	o: 156()

nname: 151
n 151(None)[]:
	i: 120(f)
	o: 156()

nname: 133
n 133(None)[vdrv += ':outwin=%g,%g,%g,%g' % outwin
]:
	i: 120(t)
	o: 156(JA)

nname: 120
n 120(outwin != None)[]:
	i: 104(t)
	o: 133(t), 151(f)

nname: 104
n 104(vdrv.startswith('softdec'))[]:
	i: 45(f)
	o: 120(t), 155(f)

nname: 90
n 90(None)[adrv = adrv % 1
]:
	i: 63(f)
	o: 156()

nname: 76
n 76(None)[adrv = adrv % 0
]:
	i: 63(t)
	o: 156(JA)

nname: 63
n 63(vdrv == 'dummy')[]:
	i: 45(t)
	o: 76(t), 90(f)

nname: 45
n 45(adrv.startswith('havana'))[vdrv = vdrv
]:
	i: 21(t), 30()
	o: 63(t), 104(f)

nname: 30
n 30(None)[]:
	i: 21(f)
	o: 45()

nname: 21
n 21(vdrv)[adrv = adrv
]:
	i: 0(t), 6()
	o: 30(f), 45(t)

nname: 6
n 6(None)[]:
	i: 0(f)
	o: 21()

nname: 0
n 0(adrv)[]:
	i: 
	o: 6(f), 21(t)

nname: 45
n 45(None)[vdrv = vdrv
if adrv.startswith('havana'):
	if vdrv == 'dummy':
		adrv = adrv % 0
	else:
		adrv = adrv % 1
else:
	if vdrv.startswith('softdec'):
		if outwin != None:
			vdrv += ':outwin=%g,%g,%g,%g' % outwin
return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])
]:
	i: 0(t)
	o: 

nname: 0
n 0(None)[if not adrv:
	pass
adrv = adrv
if not vdrv:
	pass
]:
	i: 
	o: 45()

nname: 0
n 0(None)[if not adrv:
	pass
adrv = adrv
if not vdrv:
	pass
vdrv = vdrv
if adrv.startswith('havana'):
	if vdrv == 'dummy':
		adrv = adrv % 0
	else:
		adrv = adrv % 1
else:
	if vdrv.startswith('softdec'):
		if outwin != None:
			vdrv += ':outwin=%g,%g,%g,%g' % outwin
return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c914c>}
nname: 0
n 0(None)[self.wpl.media.load(uri, properties)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aabec>}
nname: 39
n 39(None)[del _[1]
self.load_uri('%s://%s' % (scheme, path), props)
]:
	i: 0(AF), 17()
	o: 

nname: 17
n 17(None)[for p in properties:
]:
	i: 0(for)
	o: 39()

nname: 0
n 0(None)[]:
	i: 
	o: 17(for), 39(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa52c>, 17: <unpyclib.structure.node instance at 0xb75aa4ec>, 39: <unpyclib.structure.node instance at 0xb75aa48c>}
nname: 0
n 0(None)[self.load_uri(uri)
self.play_loaded()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa5ac>}
nname: 0
n 0(None)[self.load(path, scheme, options)
self.play_loaded()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa3ec>}
nname: 0
n 0(None)[self.wpl.open(self._WyPlayer__get_drvs(**kwargs))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa7ec>}
nname: 0
n 0(None)[self.wpl.close()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaacc>}
nname: 0
n 0(None)[self.wpl.playback.play(start_pos, bytes)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa92c>}
nname: 0
n 0(None)[opts = ('wyts=1', 'probe=0', 'norm_speed=1', 'live=1') + options
self.play(id, scheme='rec', options=opts, **kwargs)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aae2c>}
nname: 0
n 0(None)[self.wpl.playback.stop()
self.wpl.media.flush()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaf6c>}
nname: 0
n 0(None)[self.wpl.playback.seek(float(offset))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aabec>}
nname: 81
n 81(None)[del _[1]
return self.wpl.media.vlist()
]:
	i: 0(AF), 50()
	o: 

nname: 50
n 50(None)[for s in self.wpl.media.vlist():
]:
	i: 0(for)
	o: 81()

nname: 0
n 0(None)[fields = ['id', 'codec', 'bitrate', 'width', 'height', 'framerate']
]:
	i: 
	o: 50(for), 81(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aa50c>, 81: <unpyclib.structure.node instance at 0xb75aaa4c>, 50: <unpyclib.structure.node instance at 0xb75aa4ec>}
nname: 81
n 81(None)[del _[1]
return self.wpl.media.alist()
]:
	i: 0(AF), 50()
	o: 

nname: 50
n 50(None)[for s in self.wpl.media.alist():
]:
	i: 0(for)
	o: 81()

nname: 0
n 0(None)[fields = ['id', 'codec', 'bitrate', 'lang', 'channels', 'samplerate']
]:
	i: 
	o: 50(for), 81(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aaaac>, 81: <unpyclib.structure.node instance at 0xb75aa6ac>, 50: <unpyclib.structure.node instance at 0xb75aaa4c>}
nname: 72
n 72(None)[del _[1]
return self.wpl.media.slist()
]:
	i: 0(AF), 41()
	o: 

nname: 41
n 41(None)[for s in self.wpl.media.slist():
]:
	i: 0(for)
	o: 72()

nname: 0
n 0(None)[fields = ['id', 'codec', 'lang']
]:
	i: 
	o: 41(for), 72(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aab4c>, 41: <unpyclib.structure.node instance at 0xb75aacec>, 72: <unpyclib.structure.node instance at 0xb75aad2c>}
nname: 92
n 92(None)[return False
]:
	i: 0(AL), 91()
	o: 

nname: 91
n 91(None)[]:
	i: 3(AF), 84()
	o: 92()

nname: 84
n 84(None)[return True
]:
	i: 76(), 83()
	o: 91()

nname: 83
n 83(None)[]:
	i: 43&59(f)
	o: 84()

nname: 76
n 76(None)[continue
]:
	i: 43&59(t)
	o: 84()

nname: 43&59
n 43&59(v['framerate'] > 24 or v['framerate'] < 23)[]:
	i: 35(), 42()
	o: 76(t), 83(f)

nname: 42
n 42(None)[]:
	i: 16(f)
	o: 43&59()

nname: 35
n 35(None)[continue
]:
	i: 16(t)
	o: 43&59()

nname: 16
n 16(v['width'] != 1920)[for v in self.vlist():
]:
	i: 3(for)
	o: 35(t), 42(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 91(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 92(AL)

nname: 92
n 92(None)[return False
]:
	i: 0(AL), 3(AF), 84()
	o: 

nname: 84
n 84(None)[return True
]:
	i: 16()
	o: 92()

nname: 16
n 16(None)[for v in self.vlist():
if v['width'] != 1920:
	continue
if v['framerate'] > 24 or v['framerate'] < 23:
	continue
]:
	i: 3(for)
	o: 84()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 92(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 92(AL)

nname: 92
n 92(None)[return False
]:
	i: 0(AL), 3(AF), 16()
	o: 

nname: 16
n 16(None)[for v in self.vlist():
if v['width'] != 1920:
	continue
if v['framerate'] > 24 or v['framerate'] < 23:
	continue
return True
]:
	i: 3(for)
	o: 92()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 92(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 92(AL)

nname: 16
n 16(None)[for v in self.vlist():
	if v['width'] != 1920:
		continue
	if v['framerate'] > 24 or v['framerate'] < 23:
		continue
	return True
return False
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 16(for)

nname: 0
n 0(None)[for v in self.vlist():
	if v['width'] != 1920:
		continue
	if v['framerate'] > 24 or v['framerate'] < 23:
		continue
	return True
return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75aad8c>}
nname: 6
n 6(None)[__doc__ = 'WyPlayer client interface.\n\n\tExample usage:\n\n\t>>> from wyplayer import WyPlayer\n\t>>> wpl = Wyplayer()\n\n\t>>> def status_cb(status):\n\t...\tprint "hello status! \'%s\'" % (status)\n\t>>> wpl.watch_property(\'status\', status_cb)\n\n\t>>> print "status=\'%s\'" % (status)\n\tstatus=\'closed\'\n\n\t>>> wpl.open(video=True, audio=True, subtitles=True)\n\thello status! \'idle\'\n\n\t>>> wpl.load_uri("file:///path/to/file.avi")\n\thello status! \'loading\'\n\thello status! \'idle\'\n\n\t>>> wpl.play_loaded()\n\thello status! \'playing\'\n\n\t>>> print "uri=\'%s\', status=\'%s\', speed=%f" % (wpl.uri, wpl.status, wpl.speed)\n\turi=\'file:///path/to/file.mpg\', status=\'playing\', speed=1.0\n\n\t>>> wpl.stop()\n\tstatus: \'idle\'\n\n\t>>> wpl.close()\n\tstatus: \'closed\'\n\n\tTODO: full reference for URI types and properties\n\t'
def __init__(self, havana_adapter=0, arch='stb7100'):
	self.dpl = WyPlayerProxy()
	self.wpl = self.dpl.wyplayer
	self.havana_adapter = havana_adapter
	self._WyPlayer__aspect_ratio = None
	self._WyPlayer__display_format = None
	if arch == 'stb7100':
		self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('havana2:adapter=%u:avsync=%%u' % havana_adapter, 'havana2:adapter=%u' % havana_adapter, 'softsub', 'havana2'))
	else:
		if arch == 'softdec':
			self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('softdec', 'softdec', 'softsub', 'dummy'))
		else:
			self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('dummy', 'dummy', 'dummy', 'dummy'))
	return None

def watch_property(self, name, cb):
	try:
		self.dpl.props[name].set_notify(cb)
	except KeyError:
		pass

_WyPlayer__doc_status = 'current player status.\n\n\t\t\t  possible values:\n\n\t\t\t  \t- "closed"\n\t\t\t\t- "loading"\n\t\t\t\t- "idle"\n\t\t\t\t- "playing"\n\n\t\t       '
def _WyPlayer__get_status(self):
	try:
		return self.dpl.props['status'].get()
	except:
		return 'unknown'

status = property(_WyPlayer__get_status, doc=_WyPlayer__doc_status)
_WyPlayer__doc_exception = 'last occured exception during loading or playback.\n\n\t\t\t     possible values and meanings:\n\n\t\t\t     - "" (empty string): no exception occurred\n\t\t\t     - "media:" + some text: an error occurred during stream loading\n\t\t\t     - "decode:" + some text: an error occurred during playback\n\t\t       '
def _WyPlayer__get_exception(self):
	return self.dpl.props['exception'].get()

exception = property(_WyPlayer__get_exception, doc=_WyPlayer__doc_exception)
_WyPlayer__doc_speed = 'floating point number indicating the current playback speed.\n\n\t\t   playback state is converted from speed as follows:\n\n\t\t\t- speed < -1.0: fast backward playback\n\t\t\t- speed = -1.0: normal speed backward playback\n\t\t   \t- -1.0 < speed < 0.0: slow backward playback\n\t\t\t- speed = 0.0: pause\n\t\t\t- 0.0 < speed < 1.0: slow forward playback\n\t\t\t- speed = 1.0: normal speed forward playback\n\t\t\t- 1.0 < speed: fast forward playback\n\n\t\t   note: in the current wyplayer implementation, backward playback\n\t\t   supports only a single speed which is dependent on the specific\n\t\t   media stream (depends on spacing between key video frames).\n\t\t'
def _WyPlayer__get_speed(self):
	try:
		return self.dpl.props['speed'].get()
	except:
		return 0.0

def _WyPlayer__set_speed(self, value):
	self.dpl.props['speed'].set(value)

speed = property(fget=_WyPlayer__get_speed, fset=_WyPlayer__set_speed, doc=_WyPlayer__doc_speed)
_WyPlayer__doc_uri = 'URI of the currently loaded media stream.'
def _WyPlayer__get_uri(self):
	return self.dpl.props['uri'].get()

uri = property(fget=_WyPlayer__get_uri, doc=_WyPlayer__doc_uri)
_WyPlayer__doc_duration = 'Duration of the currently loaded media stream in milliseconds.'
def _WyPlayer__get_duration(self):
	return self.dpl.props['duration'].get()

duration = property(fget=_WyPlayer__get_duration, doc=_WyPlayer__doc_duration)
_WyPlayer__doc_container = 'container type of the currently loaded media stream.'
def _WyPlayer__get_container(self):
	return self.dpl.props['container'].get()

container = property(fget=_WyPlayer__get_container, doc=_WyPlayer__doc_container)
_WyPlayer__doc_aid = 'ID number of the currently selected audio sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
def _WyPlayer__get_aid(self):
	return self.dpl.props['aid'].get()

def _WyPlayer__set_aid(self, value):
	self.dpl.props['aid'].set(value)

aid = property(fget=_WyPlayer__get_aid, fset=_WyPlayer__set_aid, doc=_WyPlayer__doc_aid)
_WyPlayer__doc_vid = 'ID number of the currently selected video sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
def _WyPlayer__get_vid(self):
	return self.dpl.props['vid'].get()

def _WyPlayer__set_vid(self, value):
	self.dpl.props['vid'].set(value)

vid = property(fget=_WyPlayer__get_vid, fset=_WyPlayer__set_vid, doc=_WyPlayer__doc_vid)
_WyPlayer__doc_sid = 'ID number of the currently selected subtitles sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
def _WyPlayer__get_sid(self):
	return self.dpl.props['sid'].get()

def _WyPlayer__set_sid(self, value):
	self.dpl.props['sid'].set(value)

sid = property(fget=_WyPlayer__get_sid, fset=_WyPlayer__set_sid, doc=_WyPlayer__doc_sid)
_WyPlayer__doc_scrambled = 'True if currently playing media stream is scrambled.'
def _WyPlayer__get_scrambled(self):
	return self.dpl.props['scrambled'].get()

scrambled = property(fget=_WyPlayer__get_scrambled, doc=_WyPlayer__doc_scrambled)
def _WyPlayer__get_pos(self, transform, pts, rel, tb):
	return dict(map(transform, ('audio', 'video', 'sub', 'data'), self.wpl.playback.pos(pts, rel, tb[0], tb[1])))

_WyPlayer__doc_byte_pos = "current offsets in bytes from the start of the stream.\n\t\t\t    all returned values in the table are the same.\n\n\t\t\t    return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t "
def _WyPlayer__get_byte_pos(self):
	return self._WyPlayer__get_pos(None, False, False, (1, 0))

byte_pos = property(fget=_WyPlayer__get_byte_pos, doc=_WyPlayer__doc_byte_pos)
_WyPlayer__doc_sec_pos = "absolute playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
def _WyPlayer__get_sec_pos(self):
	return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, False, (1, 1000))

sec_pos = property(fget=_WyPlayer__get_sec_pos, doc=_WyPlayer__doc_sec_pos)
_WyPlayer__doc_pts = "PTS (presentation time-stamp) of the latest rendered A/V/S frames,\n\t\t     in 90Khz units\n\t\t     \n\t\t     return a dict keyed with the following values:\n\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t  "
def _WyPlayer__get_pts(self):
	return self._WyPlayer__get_pos(None, True, False, (1, 90000))

pts = property(fget=_WyPlayer__get_pts, doc=_WyPlayer__doc_pts)
_WyPlayer__doc_rel_pos = "relative playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
def _WyPlayer__get_rel_pos(self):
	return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, True, (1, 1000))

rel_pos = property(fget=_WyPlayer__get_rel_pos, doc=_WyPlayer__doc_rel_pos)
_WyPlayer__doc_display_format = 'set aspect ratio adaptation method.\n\n\t\t\t\t  valid values are "pan_scan", "letter_box", "center_cut_out", or "fullscreen"\n\t\t\t       '
def _WyPlayer__set_display_format(self, format):
	if format not in ('pan_scan', 'letter_box', 'center_cut_out', 'fullscreen'):
		pass
	self._WyPlayer__display_format = format
	self.wpl.set_vopts('display_format=%s' % format)

def _WyPlayer__get_display_format(self):
	return self._WyPlayer__display_format

display_format = property(fget=_WyPlayer__get_display_format, fset=_WyPlayer__set_display_format, doc=_WyPlayer__doc_display_format)
_WyPlayer__doc_aspect_ratio = 'set monitor\'s aspect ratio.\n\t\t\t\t\n\t\t\t\tuse "4_3" for a 4/3 TV.\n\t\t\t\tuse "16_9" for a 16/9 TV.\n\t\t\t     '
def _WyPlayer__set_aspect_ratio(self, ratio):
	if ratio not in ('4_3', '16_9'):
		pass
	self._WyPlayer__aspect_ratio = ratio
	self.wpl.set_vopts('tv_aspect_ratio=%s' % ratio)

def _WyPlayer__get_aspect_ratio(self):
	return self._WyPlayer__aspect_ratio

aspect_ratio = property(fget=_WyPlayer__get_aspect_ratio, fset=_WyPlayer__set_aspect_ratio, doc=_WyPlayer__doc_aspect_ratio)
_WyPlayer__doc_spdif_surround = 'enable or disable sending raw surround data to the SP/DIF output.\n\n\t\t\t\t  if False, send PCM audio data.\n\t\t\t\t  if True, send raw undecoded audio frames. may be AC3, DTS, or\n\t\t\t\t  any audio codec supported by an external amplifier connected\n\t\t\t\t  through SP/DIF or HDMI.\n\t\t\t       '
def _WyPlayer__set_spdif_surround(self, enable):
	if enable not in (False, True):
		pass
	self.wpl.set_aopts('spdif_es=%u' % int(enable))

spdif_surround = property(fset=_WyPlayer__set_spdif_surround, doc=_WyPlayer__doc_spdif_surround)
def _WyPlayer__get_drvs(self, audio=True, video=True, subtitles=True, data=True, osd=True, outwin=None, adrv=None, vdrv=None):
	if not adrv:
		pass
	adrv = adrv
	if not vdrv:
		pass
	vdrv = vdrv
	if adrv.startswith('havana'):
		if vdrv == 'dummy':
			adrv = adrv % 0
		else:
			adrv = adrv % 1
	else:
		if vdrv.startswith('softdec'):
			if outwin != None:
				vdrv += ':outwin=%g,%g,%g,%g' % outwin
	return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])

def load_uri(self, uri, properties={}):
	self.wpl.media.load(uri, properties)

def load(self, path, scheme='file', properties=()):
	pass

def play_uri(self, uri):
	self.load_uri(uri)
	self.play_loaded()

def play(self, path, scheme='file', options=(), **kwargs):
	self.load(path, scheme, options)
	self.play_loaded()

def open(self, **kwargs):
	self.wpl.open(self._WyPlayer__get_drvs(**kwargs))

def close(self):
	self.wpl.close()

def play_loaded(self, start_pos=0.0, bytes=False):
	self.wpl.playback.play(start_pos, bytes)

def play_rec(self, id, options=(), **kwargs):
	opts = ('wyts=1', 'probe=0', 'norm_speed=1', 'live=1') + options
	self.play(id, scheme='rec', options=opts, **kwargs)

def stop(self):
	self.wpl.playback.stop()
	self.wpl.media.flush()

def seek(self, offset):
	self.wpl.playback.seek(float(offset))

def vlist(self):
	fields = ['id', 'codec', 'bitrate', 'width', 'height', 'framerate']

def alist(self):
	fields = ['id', 'codec', 'bitrate', 'lang', 'channels', 'samplerate']

def slist(self):
	fields = ['id', 'codec', 'lang']

def is_cinema(self):
	for v in self.vlist():
		if v['width'] != 1920:
			continue
		if v['framerate'] > 24 or v['framerate'] < 23:
			continue
		return True
	return False

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75a6c0c>}
nname: 0
n 0(None)[import urllib
from wyplayer_dbus import WyPlayerProxy
import wydbus
class WyPlayer(object):
	__doc__ = 'WyPlayer client interface.\n\n\tExample usage:\n\n\t>>> from wyplayer import WyPlayer\n\t>>> wpl = Wyplayer()\n\n\t>>> def status_cb(status):\n\t...\tprint "hello status! \'%s\'" % (status)\n\t>>> wpl.watch_property(\'status\', status_cb)\n\n\t>>> print "status=\'%s\'" % (status)\n\tstatus=\'closed\'\n\n\t>>> wpl.open(video=True, audio=True, subtitles=True)\n\thello status! \'idle\'\n\n\t>>> wpl.load_uri("file:///path/to/file.avi")\n\thello status! \'loading\'\n\thello status! \'idle\'\n\n\t>>> wpl.play_loaded()\n\thello status! \'playing\'\n\n\t>>> print "uri=\'%s\', status=\'%s\', speed=%f" % (wpl.uri, wpl.status, wpl.speed)\n\turi=\'file:///path/to/file.mpg\', status=\'playing\', speed=1.0\n\n\t>>> wpl.stop()\n\tstatus: \'idle\'\n\n\t>>> wpl.close()\n\tstatus: \'closed\'\n\n\tTODO: full reference for URI types and properties\n\t'
	def __init__(self, havana_adapter=0, arch='stb7100'):
		self.dpl = WyPlayerProxy()
		self.wpl = self.dpl.wyplayer
		self.havana_adapter = havana_adapter
		self._WyPlayer__aspect_ratio = None
		self._WyPlayer__display_format = None
		if arch == 'stb7100':
			self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('havana2:adapter=%u:avsync=%%u' % havana_adapter, 'havana2:adapter=%u' % havana_adapter, 'softsub', 'havana2'))
		else:
			if arch == 'softdec':
				self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('softdec', 'softdec', 'softsub', 'dummy'))
			else:
				self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('dummy', 'dummy', 'dummy', 'dummy'))
		return None

	def watch_property(self, name, cb):
		try:
			self.dpl.props[name].set_notify(cb)
		except KeyError:
			pass

	_WyPlayer__doc_status = 'current player status.\n\n\t\t\t  possible values:\n\n\t\t\t  \t- "closed"\n\t\t\t\t- "loading"\n\t\t\t\t- "idle"\n\t\t\t\t- "playing"\n\n\t\t       '
	def _WyPlayer__get_status(self):
		try:
			return self.dpl.props['status'].get()
		except:
			return 'unknown'

	status = property(_WyPlayer__get_status, doc=_WyPlayer__doc_status)
	_WyPlayer__doc_exception = 'last occured exception during loading or playback.\n\n\t\t\t     possible values and meanings:\n\n\t\t\t     - "" (empty string): no exception occurred\n\t\t\t     - "media:" + some text: an error occurred during stream loading\n\t\t\t     - "decode:" + some text: an error occurred during playback\n\t\t       '
	def _WyPlayer__get_exception(self):
		return self.dpl.props['exception'].get()

	exception = property(_WyPlayer__get_exception, doc=_WyPlayer__doc_exception)
	_WyPlayer__doc_speed = 'floating point number indicating the current playback speed.\n\n\t\t   playback state is converted from speed as follows:\n\n\t\t\t- speed < -1.0: fast backward playback\n\t\t\t- speed = -1.0: normal speed backward playback\n\t\t   \t- -1.0 < speed < 0.0: slow backward playback\n\t\t\t- speed = 0.0: pause\n\t\t\t- 0.0 < speed < 1.0: slow forward playback\n\t\t\t- speed = 1.0: normal speed forward playback\n\t\t\t- 1.0 < speed: fast forward playback\n\n\t\t   note: in the current wyplayer implementation, backward playback\n\t\t   supports only a single speed which is dependent on the specific\n\t\t   media stream (depends on spacing between key video frames).\n\t\t'
	def _WyPlayer__get_speed(self):
		try:
			return self.dpl.props['speed'].get()
		except:
			return 0.0

	def _WyPlayer__set_speed(self, value):
		self.dpl.props['speed'].set(value)

	speed = property(fget=_WyPlayer__get_speed, fset=_WyPlayer__set_speed, doc=_WyPlayer__doc_speed)
	_WyPlayer__doc_uri = 'URI of the currently loaded media stream.'
	def _WyPlayer__get_uri(self):
		return self.dpl.props['uri'].get()

	uri = property(fget=_WyPlayer__get_uri, doc=_WyPlayer__doc_uri)
	_WyPlayer__doc_duration = 'Duration of the currently loaded media stream in milliseconds.'
	def _WyPlayer__get_duration(self):
		return self.dpl.props['duration'].get()

	duration = property(fget=_WyPlayer__get_duration, doc=_WyPlayer__doc_duration)
	_WyPlayer__doc_container = 'container type of the currently loaded media stream.'
	def _WyPlayer__get_container(self):
		return self.dpl.props['container'].get()

	container = property(fget=_WyPlayer__get_container, doc=_WyPlayer__doc_container)
	_WyPlayer__doc_aid = 'ID number of the currently selected audio sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_aid(self):
		return self.dpl.props['aid'].get()

	def _WyPlayer__set_aid(self, value):
		self.dpl.props['aid'].set(value)

	aid = property(fget=_WyPlayer__get_aid, fset=_WyPlayer__set_aid, doc=_WyPlayer__doc_aid)
	_WyPlayer__doc_vid = 'ID number of the currently selected video sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_vid(self):
		return self.dpl.props['vid'].get()

	def _WyPlayer__set_vid(self, value):
		self.dpl.props['vid'].set(value)

	vid = property(fget=_WyPlayer__get_vid, fset=_WyPlayer__set_vid, doc=_WyPlayer__doc_vid)
	_WyPlayer__doc_sid = 'ID number of the currently selected subtitles sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_sid(self):
		return self.dpl.props['sid'].get()

	def _WyPlayer__set_sid(self, value):
		self.dpl.props['sid'].set(value)

	sid = property(fget=_WyPlayer__get_sid, fset=_WyPlayer__set_sid, doc=_WyPlayer__doc_sid)
	_WyPlayer__doc_scrambled = 'True if currently playing media stream is scrambled.'
	def _WyPlayer__get_scrambled(self):
		return self.dpl.props['scrambled'].get()

	scrambled = property(fget=_WyPlayer__get_scrambled, doc=_WyPlayer__doc_scrambled)
	def _WyPlayer__get_pos(self, transform, pts, rel, tb):
		return dict(map(transform, ('audio', 'video', 'sub', 'data'), self.wpl.playback.pos(pts, rel, tb[0], tb[1])))

	_WyPlayer__doc_byte_pos = "current offsets in bytes from the start of the stream.\n\t\t\t    all returned values in the table are the same.\n\n\t\t\t    return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t "
	def _WyPlayer__get_byte_pos(self):
		return self._WyPlayer__get_pos(None, False, False, (1, 0))

	byte_pos = property(fget=_WyPlayer__get_byte_pos, doc=_WyPlayer__doc_byte_pos)
	_WyPlayer__doc_sec_pos = "absolute playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
	def _WyPlayer__get_sec_pos(self):
		return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, False, (1, 1000))

	sec_pos = property(fget=_WyPlayer__get_sec_pos, doc=_WyPlayer__doc_sec_pos)
	_WyPlayer__doc_pts = "PTS (presentation time-stamp) of the latest rendered A/V/S frames,\n\t\t     in 90Khz units\n\t\t     \n\t\t     return a dict keyed with the following values:\n\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t  "
	def _WyPlayer__get_pts(self):
		return self._WyPlayer__get_pos(None, True, False, (1, 90000))

	pts = property(fget=_WyPlayer__get_pts, doc=_WyPlayer__doc_pts)
	_WyPlayer__doc_rel_pos = "relative playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
	def _WyPlayer__get_rel_pos(self):
		return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, True, (1, 1000))

	rel_pos = property(fget=_WyPlayer__get_rel_pos, doc=_WyPlayer__doc_rel_pos)
	_WyPlayer__doc_display_format = 'set aspect ratio adaptation method.\n\n\t\t\t\t  valid values are "pan_scan", "letter_box", "center_cut_out", or "fullscreen"\n\t\t\t       '
	def _WyPlayer__set_display_format(self, format):
		if format not in ('pan_scan', 'letter_box', 'center_cut_out', 'fullscreen'):
			pass
		self._WyPlayer__display_format = format
		self.wpl.set_vopts('display_format=%s' % format)

	def _WyPlayer__get_display_format(self):
		return self._WyPlayer__display_format

	display_format = property(fget=_WyPlayer__get_display_format, fset=_WyPlayer__set_display_format, doc=_WyPlayer__doc_display_format)
	_WyPlayer__doc_aspect_ratio = 'set monitor\'s aspect ratio.\n\t\t\t\t\n\t\t\t\tuse "4_3" for a 4/3 TV.\n\t\t\t\tuse "16_9" for a 16/9 TV.\n\t\t\t     '
	def _WyPlayer__set_aspect_ratio(self, ratio):
		if ratio not in ('4_3', '16_9'):
			pass
		self._WyPlayer__aspect_ratio = ratio
		self.wpl.set_vopts('tv_aspect_ratio=%s' % ratio)

	def _WyPlayer__get_aspect_ratio(self):
		return self._WyPlayer__aspect_ratio

	aspect_ratio = property(fget=_WyPlayer__get_aspect_ratio, fset=_WyPlayer__set_aspect_ratio, doc=_WyPlayer__doc_aspect_ratio)
	_WyPlayer__doc_spdif_surround = 'enable or disable sending raw surround data to the SP/DIF output.\n\n\t\t\t\t  if False, send PCM audio data.\n\t\t\t\t  if True, send raw undecoded audio frames. may be AC3, DTS, or\n\t\t\t\t  any audio codec supported by an external amplifier connected\n\t\t\t\t  through SP/DIF or HDMI.\n\t\t\t       '
	def _WyPlayer__set_spdif_surround(self, enable):
		if enable not in (False, True):
			pass
		self.wpl.set_aopts('spdif_es=%u' % int(enable))

	spdif_surround = property(fset=_WyPlayer__set_spdif_surround, doc=_WyPlayer__doc_spdif_surround)
	def _WyPlayer__get_drvs(self, audio=True, video=True, subtitles=True, data=True, osd=True, outwin=None, adrv=None, vdrv=None):
		if not adrv:
			pass
		adrv = adrv
		if not vdrv:
			pass
		vdrv = vdrv
		if adrv.startswith('havana'):
			if vdrv == 'dummy':
				adrv = adrv % 0
			else:
				adrv = adrv % 1
		else:
			if vdrv.startswith('softdec'):
				if outwin != None:
					vdrv += ':outwin=%g,%g,%g,%g' % outwin
		return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])

	def load_uri(self, uri, properties={}):
		self.wpl.media.load(uri, properties)

	def load(self, path, scheme='file', properties=()):
		pass

	def play_uri(self, uri):
		self.load_uri(uri)
		self.play_loaded()

	def play(self, path, scheme='file', options=(), **kwargs):
		self.load(path, scheme, options)
		self.play_loaded()

	def open(self, **kwargs):
		self.wpl.open(self._WyPlayer__get_drvs(**kwargs))

	def close(self):
		self.wpl.close()

	def play_loaded(self, start_pos=0.0, bytes=False):
		self.wpl.playback.play(start_pos, bytes)

	def play_rec(self, id, options=(), **kwargs):
		opts = ('wyts=1', 'probe=0', 'norm_speed=1', 'live=1') + options
		self.play(id, scheme='rec', options=opts, **kwargs)

	def stop(self):
		self.wpl.playback.stop()
		self.wpl.media.flush()

	def seek(self, offset):
		self.wpl.playback.seek(float(offset))

	def vlist(self):
		fields = ['id', 'codec', 'bitrate', 'width', 'height', 'framerate']

	def alist(self):
		fields = ['id', 'codec', 'bitrate', 'lang', 'channels', 'samplerate']

	def slist(self):
		fields = ['id', 'codec', 'lang']

	def is_cinema(self):
		for v in self.vlist():
			if v['width'] != 1920:
				continue
			if v['framerate'] > 24 or v['framerate'] < 23:
				continue
			return True
		return False



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7596dec>}
import urllib
from wyplayer_dbus import WyPlayerProxy
import wydbus
class WyPlayer(object):
	__doc__ = 'WyPlayer client interface.\n\n\tExample usage:\n\n\t>>> from wyplayer import WyPlayer\n\t>>> wpl = Wyplayer()\n\n\t>>> def status_cb(status):\n\t...\tprint "hello status! \'%s\'" % (status)\n\t>>> wpl.watch_property(\'status\', status_cb)\n\n\t>>> print "status=\'%s\'" % (status)\n\tstatus=\'closed\'\n\n\t>>> wpl.open(video=True, audio=True, subtitles=True)\n\thello status! \'idle\'\n\n\t>>> wpl.load_uri("file:///path/to/file.avi")\n\thello status! \'loading\'\n\thello status! \'idle\'\n\n\t>>> wpl.play_loaded()\n\thello status! \'playing\'\n\n\t>>> print "uri=\'%s\', status=\'%s\', speed=%f" % (wpl.uri, wpl.status, wpl.speed)\n\turi=\'file:///path/to/file.mpg\', status=\'playing\', speed=1.0\n\n\t>>> wpl.stop()\n\tstatus: \'idle\'\n\n\t>>> wpl.close()\n\tstatus: \'closed\'\n\n\tTODO: full reference for URI types and properties\n\t'
	def __init__(self, havana_adapter=0, arch='stb7100'):
		self.dpl = WyPlayerProxy()
		self.wpl = self.dpl.wyplayer
		self.havana_adapter = havana_adapter
		self._WyPlayer__aspect_ratio = None
		self._WyPlayer__display_format = None
		if arch == 'stb7100':
			self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('havana2:adapter=%u:avsync=%%u' % havana_adapter, 'havana2:adapter=%u' % havana_adapter, 'softsub', 'havana2'))
		else:
			if arch == 'softdec':
				self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('softdec', 'softdec', 'softsub', 'dummy'))
			else:
				self.drivers = (('dummy', 'dummy', 'dummy', 'dummy'), ('dummy', 'dummy', 'dummy', 'dummy'))
		return None

	def watch_property(self, name, cb):
		try:
			self.dpl.props[name].set_notify(cb)
		except KeyError:
			pass

	_WyPlayer__doc_status = 'current player status.\n\n\t\t\t  possible values:\n\n\t\t\t  \t- "closed"\n\t\t\t\t- "loading"\n\t\t\t\t- "idle"\n\t\t\t\t- "playing"\n\n\t\t       '
	def _WyPlayer__get_status(self):
		try:
			return self.dpl.props['status'].get()
		except:
			return 'unknown'

	status = property(_WyPlayer__get_status, doc=_WyPlayer__doc_status)
	_WyPlayer__doc_exception = 'last occured exception during loading or playback.\n\n\t\t\t     possible values and meanings:\n\n\t\t\t     - "" (empty string): no exception occurred\n\t\t\t     - "media:" + some text: an error occurred during stream loading\n\t\t\t     - "decode:" + some text: an error occurred during playback\n\t\t       '
	def _WyPlayer__get_exception(self):
		return self.dpl.props['exception'].get()

	exception = property(_WyPlayer__get_exception, doc=_WyPlayer__doc_exception)
	_WyPlayer__doc_speed = 'floating point number indicating the current playback speed.\n\n\t\t   playback state is converted from speed as follows:\n\n\t\t\t- speed < -1.0: fast backward playback\n\t\t\t- speed = -1.0: normal speed backward playback\n\t\t   \t- -1.0 < speed < 0.0: slow backward playback\n\t\t\t- speed = 0.0: pause\n\t\t\t- 0.0 < speed < 1.0: slow forward playback\n\t\t\t- speed = 1.0: normal speed forward playback\n\t\t\t- 1.0 < speed: fast forward playback\n\n\t\t   note: in the current wyplayer implementation, backward playback\n\t\t   supports only a single speed which is dependent on the specific\n\t\t   media stream (depends on spacing between key video frames).\n\t\t'
	def _WyPlayer__get_speed(self):
		try:
			return self.dpl.props['speed'].get()
		except:
			return 0.0

	def _WyPlayer__set_speed(self, value):
		self.dpl.props['speed'].set(value)

	speed = property(fget=_WyPlayer__get_speed, fset=_WyPlayer__set_speed, doc=_WyPlayer__doc_speed)
	_WyPlayer__doc_uri = 'URI of the currently loaded media stream.'
	def _WyPlayer__get_uri(self):
		return self.dpl.props['uri'].get()

	uri = property(fget=_WyPlayer__get_uri, doc=_WyPlayer__doc_uri)
	_WyPlayer__doc_duration = 'Duration of the currently loaded media stream in milliseconds.'
	def _WyPlayer__get_duration(self):
		return self.dpl.props['duration'].get()

	duration = property(fget=_WyPlayer__get_duration, doc=_WyPlayer__doc_duration)
	_WyPlayer__doc_container = 'container type of the currently loaded media stream.'
	def _WyPlayer__get_container(self):
		return self.dpl.props['container'].get()

	container = property(fget=_WyPlayer__get_container, doc=_WyPlayer__doc_container)
	_WyPlayer__doc_aid = 'ID number of the currently selected audio sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_aid(self):
		return self.dpl.props['aid'].get()

	def _WyPlayer__set_aid(self, value):
		self.dpl.props['aid'].set(value)

	aid = property(fget=_WyPlayer__get_aid, fset=_WyPlayer__set_aid, doc=_WyPlayer__doc_aid)
	_WyPlayer__doc_vid = 'ID number of the currently selected video sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_vid(self):
		return self.dpl.props['vid'].get()

	def _WyPlayer__set_vid(self, value):
		self.dpl.props['vid'].set(value)

	vid = property(fget=_WyPlayer__get_vid, fset=_WyPlayer__set_vid, doc=_WyPlayer__doc_vid)
	_WyPlayer__doc_sid = 'ID number of the currently selected subtitles sub-stream.\n\t\t       frames from other sub-streams are dropped during playback.'
	def _WyPlayer__get_sid(self):
		return self.dpl.props['sid'].get()

	def _WyPlayer__set_sid(self, value):
		self.dpl.props['sid'].set(value)

	sid = property(fget=_WyPlayer__get_sid, fset=_WyPlayer__set_sid, doc=_WyPlayer__doc_sid)
	_WyPlayer__doc_scrambled = 'True if currently playing media stream is scrambled.'
	def _WyPlayer__get_scrambled(self):
		return self.dpl.props['scrambled'].get()

	scrambled = property(fget=_WyPlayer__get_scrambled, doc=_WyPlayer__doc_scrambled)
	def _WyPlayer__get_pos(self, transform, pts, rel, tb):
		return dict(map(transform, ('audio', 'video', 'sub', 'data'), self.wpl.playback.pos(pts, rel, tb[0], tb[1])))

	_WyPlayer__doc_byte_pos = "current offsets in bytes from the start of the stream.\n\t\t\t    all returned values in the table are the same.\n\n\t\t\t    return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t "
	def _WyPlayer__get_byte_pos(self):
		return self._WyPlayer__get_pos(None, False, False, (1, 0))

	byte_pos = property(fget=_WyPlayer__get_byte_pos, doc=_WyPlayer__doc_byte_pos)
	_WyPlayer__doc_sec_pos = "absolute playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
	def _WyPlayer__get_sec_pos(self):
		return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, False, (1, 1000))

	sec_pos = property(fget=_WyPlayer__get_sec_pos, doc=_WyPlayer__doc_sec_pos)
	_WyPlayer__doc_pts = "PTS (presentation time-stamp) of the latest rendered A/V/S frames,\n\t\t     in 90Khz units\n\t\t     \n\t\t     return a dict keyed with the following values:\n\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t  "
	def _WyPlayer__get_pts(self):
		return self._WyPlayer__get_pos(None, True, False, (1, 90000))

	pts = property(fget=_WyPlayer__get_pts, doc=_WyPlayer__doc_pts)
	_WyPlayer__doc_rel_pos = "relative playback positions (A/V/S) from the start of the stream, in seconds.\n\t\n\t\t\t   return a dict keyed with the following values:\n\t\t\t    \t'audio', 'video', 'sub', 'data'\n\t\t\t"
	def _WyPlayer__get_rel_pos(self):
		return self._WyPlayer__get_pos((lambda x, y: (x, y / 1000.0)), True, True, (1, 1000))

	rel_pos = property(fget=_WyPlayer__get_rel_pos, doc=_WyPlayer__doc_rel_pos)
	_WyPlayer__doc_display_format = 'set aspect ratio adaptation method.\n\n\t\t\t\t  valid values are "pan_scan", "letter_box", "center_cut_out", or "fullscreen"\n\t\t\t       '
	def _WyPlayer__set_display_format(self, format):
		if format not in ('pan_scan', 'letter_box', 'center_cut_out', 'fullscreen'):
			pass
		self._WyPlayer__display_format = format
		self.wpl.set_vopts('display_format=%s' % format)

	def _WyPlayer__get_display_format(self):
		return self._WyPlayer__display_format

	display_format = property(fget=_WyPlayer__get_display_format, fset=_WyPlayer__set_display_format, doc=_WyPlayer__doc_display_format)
	_WyPlayer__doc_aspect_ratio = 'set monitor\'s aspect ratio.\n\t\t\t\t\n\t\t\t\tuse "4_3" for a 4/3 TV.\n\t\t\t\tuse "16_9" for a 16/9 TV.\n\t\t\t     '
	def _WyPlayer__set_aspect_ratio(self, ratio):
		if ratio not in ('4_3', '16_9'):
			pass
		self._WyPlayer__aspect_ratio = ratio
		self.wpl.set_vopts('tv_aspect_ratio=%s' % ratio)

	def _WyPlayer__get_aspect_ratio(self):
		return self._WyPlayer__aspect_ratio

	aspect_ratio = property(fget=_WyPlayer__get_aspect_ratio, fset=_WyPlayer__set_aspect_ratio, doc=_WyPlayer__doc_aspect_ratio)
	_WyPlayer__doc_spdif_surround = 'enable or disable sending raw surround data to the SP/DIF output.\n\n\t\t\t\t  if False, send PCM audio data.\n\t\t\t\t  if True, send raw undecoded audio frames. may be AC3, DTS, or\n\t\t\t\t  any audio codec supported by an external amplifier connected\n\t\t\t\t  through SP/DIF or HDMI.\n\t\t\t       '
	def _WyPlayer__set_spdif_surround(self, enable):
		if enable not in (False, True):
			pass
		self.wpl.set_aopts('spdif_es=%u' % int(enable))

	spdif_surround = property(fset=_WyPlayer__set_spdif_surround, doc=_WyPlayer__doc_spdif_surround)
	def _WyPlayer__get_drvs(self, audio=True, video=True, subtitles=True, data=True, osd=True, outwin=None, adrv=None, vdrv=None):
		if not adrv:
			pass
		adrv = adrv
		if not vdrv:
			pass
		vdrv = vdrv
		if adrv.startswith('havana'):
			if vdrv == 'dummy':
				adrv = adrv % 0
			else:
				adrv = adrv % 1
		else:
			if vdrv.startswith('softdec'):
				if outwin != None:
					vdrv += ':outwin=%g,%g,%g,%g' % outwin
		return '%s %s %s %s' % (adrv, vdrv, self.drivers[subtitles][2], self.drivers[data][3])

	def load_uri(self, uri, properties={}):
		self.wpl.media.load(uri, properties)

	def load(self, path, scheme='file', properties=()):
		pass

	def play_uri(self, uri):
		self.load_uri(uri)
		self.play_loaded()

	def play(self, path, scheme='file', options=(), **kwargs):
		self.load(path, scheme, options)
		self.play_loaded()

	def open(self, **kwargs):
		self.wpl.open(self._WyPlayer__get_drvs(**kwargs))

	def close(self):
		self.wpl.close()

	def play_loaded(self, start_pos=0.0, bytes=False):
		self.wpl.playback.play(start_pos, bytes)

	def play_rec(self, id, options=(), **kwargs):
		opts = ('wyts=1', 'probe=0', 'norm_speed=1', 'live=1') + options
		self.play(id, scheme='rec', options=opts, **kwargs)

	def stop(self):
		self.wpl.playback.stop()
		self.wpl.media.flush()

	def seek(self, offset):
		self.wpl.playback.seek(float(offset))

	def vlist(self):
		fields = ['id', 'codec', 'bitrate', 'width', 'height', 'framerate']

	def alist(self):
		fields = ['id', 'codec', 'bitrate', 'lang', 'channels', 'samplerate']

	def slist(self):
		fields = ['id', 'codec', 'lang']

	def is_cinema(self):
		for v in self.vlist():
			if v['width'] != 1920:
				continue
			if v['framerate'] > 24 or v['framerate'] < 23:
				continue
			return True
		return False



